//
//  WhTSpriteFactory.m
//  ProjectM
//
//  Created by ris on 11-3-27.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "WhTSpriteFactory.h"


@implementation WhTSpriteFactory

+ (NSMutableDictionary *)createWithStageInfo:(NSArray *)stage 
															 outStageIndex:(int *)index
{
	int capacity = [stage count]-1;
	*index = [[stage objectAtIndex:0] intValue];
	NSMutableDictionary *objs = [[NSMutableDictionary alloc] initWithCapacity:capacity];
	for (int i = 1; i < capacity+1; ++i) 
	{
		NSString *path = [stage objectAtIndex:i];
		NSArray *array = [path componentsSeparatedByString:@"."];
		NSString *key = [array objectAtIndex:0];
		WhTSprite *sprite = [[WhTSprite alloc] initWithPaths:path,nil]; 
		[objs setObject:sprite forKey:key];
		[sprite release];
	}
	return objs;
}

@end
